package com.yingsheng.bi.hks.template.controller;

import com.yingsheng.bi.hks.template.ITemplate;
import com.yingsheng.bi.hks.template.SimpleTemplate;
import com.yingsheng.bi.hks.template.events.Event;
import com.yingsheng.bi.hks.template.processor.Processor;

public class SimpleControllerTemplate extends SimpleTemplate implements IControllerTemplate {

    private Processor initLogic;

    public Processor getInitLogic() {
        return initLogic;
    }

    public void setInitLogic(Processor initLogic) {
        this.initLogic = initLogic;
    }

    @Override
    public void init(Event event) {
        if (initLogic != null) {
            initLogic.exec(event);
        }
        ITemplate parent = getParent();
        if (parent != null && parent instanceof IControllerTemplate) {
            ((IControllerTemplate) parent).init(event);
        }
    }
}
